// import myPromise from "./util";
const myPromise = require('./util')

console.log(1)
let promise1 = new myPromise((resolve, reject) => {
  // throw new Error('出错了')
  console.log(2)
  setTimeout(() => {
    resolve('成功');
    console.log(6);
  }, 300);
  
  // reject('失败')
})

promise1.then(
  res => {
    console.log(3, res)
  },
  err => {
    console.log(4, err)
  }
);
console.log(5)
